package com.aifast.common.desensitize;

import cn.hutool.core.util.DesensitizedUtil;

import java.util.function.Function;

/**
 * 数据脱敏类型
 */
public enum DesensitizeType {
    //用户id
    USER_ID(s -> DesensitizedUtil.desensitized(s, DesensitizedUtil.DesensitizedType.USER_ID)),
    //中文名
    CHINESE_NAME(s -> DesensitizedUtil.desensitized(s, DesensitizedUtil.DesensitizedType.CHINESE_NAME)),
    //身份证号
    ID_CARD(s -> DesensitizedUtil.desensitized(s, DesensitizedUtil.DesensitizedType.ID_CARD)),
    //座机号
    FIXED_PHONE(s -> DesensitizedUtil.desensitized(s, DesensitizedUtil.DesensitizedType.FIXED_PHONE)),
    //手机号
    MOBILE_PHONE(s -> DesensitizedUtil.desensitized(s, DesensitizedUtil.DesensitizedType.MOBILE_PHONE)),
    //地址
    ADDRESS(s -> DesensitizedUtil.desensitized(s, DesensitizedUtil.DesensitizedType.ADDRESS)),
    //电子邮件
    EMAIL(s -> DesensitizedUtil.desensitized(s, DesensitizedUtil.DesensitizedType.EMAIL)),
    //密码
    PASSWORD(s -> DesensitizedUtil.desensitized(s, DesensitizedUtil.DesensitizedType.PASSWORD)),
    //中国大陆车牌，包含普通车辆、新能源车辆
    CAR_LICENSE(s -> DesensitizedUtil.desensitized(s, DesensitizedUtil.DesensitizedType.CAR_LICENSE)),
    //银行卡
    BANK_CARD(s -> DesensitizedUtil.desensitized(s, DesensitizedUtil.DesensitizedType.BANK_CARD));

    private Function<String, String> function;

    DesensitizeType(Function<String, String> function) {
        this.function = function;
    }

    public Function<String, String> function() {
        return this.function;
    }

}
